home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
M
/
Lex.cpt
/
Lex
/
ABC.LXI
next >
Wrap
Text File
|
1990-04-20
|
730b
|
31 lines
/*
* An example lex input file to show the effects of quotes,
* apostrophes, and upper and lower case letters.
*/
c = [C];
break = [;]; /* to test the effect */
illegal = [0-9];
ignore = [,./;:];
%{
#include <stdlib.h>
main()
{
int token_number;
while(token_number = yylex())
printf("\nyylex returns %d\n", token_number);
printf("\nyylex returns NULL\n");
}
%}
%%
'a' { printf("yylex: a\n"); return(1);}
'A' { printf("yylex: A\n"); return(2);}
"b" { printf("yylex: b\n"); return(3);}
"B" { printf("yylex: B\n"); return(4);}
C { printf("yylex: c\n"); return(5);}
c { printf("yylex: C\n"); return(6);}
[\n\r\t ] { printf("yylex: white space\n"); return(LEXSKIP);}
%%
void yyinit() {}